import { fire } from "./shooting/fire.js";
import { currentRole } from "../index.js";
import { move } from "./move.js";
export const setKey = (key) => {
    scheduler[key] || (scheduler[key] = "down");
};
export const removeKey = (key) => {
    scheduler[key] && delete scheduler[key];
};
const scheduler = {};
//指令动作
const actions = () => {
    const keys = Object.keys(scheduler);
    keys.forEach((k) => {
        //判断移动的位置是否是边界
        switch (k) {
            case "a":
            case "d":
            case "w":
            case "s":
                move(k);
                break;
            case "j":
                fire(currentRole);
                break;
        }
    });
    requestAnimationFrame(actions);
};
requestAnimationFrame(actions);
